package org.zn.etl.misc;

import java.util.HashMap;
import java.util.Map;

import org.zn.etl.datasource.DataSourceKey;
import org.zn.etl.datasource.entity.DataSourceInfo;

public class DataSourceInfo2ConfigMap {
	
	public static Map<String, String> toMap(DataSourceInfo source){
		
		Map<String, String> sourceConfig=new HashMap<String, String>();
		sourceConfig.put(DataSourceKey.JDBC_URL, source.getUrl());
		sourceConfig.put(DataSourceKey.PASSWORD, source.getPassword());
		sourceConfig.put(DataSourceKey.USERNAME, source.getUsername());
		sourceConfig.put(DataSourceKey.DRIVER_CLASS,  DriverClassType.getClassName(source.getDbType()));
		sourceConfig.put(DataSourceKey.MAX_POOL_SIZE, source.getConnectSize().toString());
		sourceConfig.put(DataSourceKey.MIN_SIZE, "5");
		return sourceConfig;
		
	}

}
